<template>
	<view>
		<uni-table>
			<uni-tr>
				<uni-th></uni-th>
		            <uni-th>客户姓名</uni-th>
		            <uni-th>联系方式</uni-th>
		            <uni-th>消费信息</uni-th>
			</uni-tr>
			<uni-tr v-for="(item,index) in array" :key="index">
		            <uni-td><img class="img" :src="item.avatar?item.avatar:defaultImg" /></uni-td>
		            <uni-td>{{item.username}}</uni-td>
		            <uni-td>{{item.mobile}}</uni-td>
		            <uni-td>
						<view>
							<view style="text-align: center;line-height: 50upx;">订单数:{{item.count}}</view>
							<view style="color: #D7000F;text-align: center;line-height: 50upx;">金额:{{item.amount}}</view>
						</view>
					</uni-td>
		        </uni-tr>
		</uni-table>
	</view>
</template>

<script>
	import { get,post,showToast } from '../../js/common';
	export default {
		data() {
			return {
				userId:'',
				array:[],
				avatar:'',
				username:'',
				count:'',
				amount:'',
				defaultImg: '/static/logo.png'
			};
		},
		onLoad() {
			this.getTeamByUserId()
		},
		methods:{
			getTeamByUserId() {
				try {
					this.userId = uni.getStorageSync('userId')
					const params = {
						userId: this.userId
					}
					post('mobileapi/pcdis/getTeamByUserId', params).then(res => {
						if(res.data){
							this.array = res.data
						}
					})
				} catch (e) {}
			},
		}
	}
</script>

<style>
	.title{
		text-align: center;
		font-size: 28upx;
		display: flex;
		background: #eeeeee;
		height: 80upx;
		line-height: 100upx;
	}
	.box{
		flex: 1;
		height: 120upx;
	}
	.img{
		width: 100upx;
		height: 100upx;
		border-radius: 50%;
	}
	.foot{
		background: #ffffff;
		border-bottom: 2upx solid #E6E6E6;
		text-align: center;
		display: flex;
		font-size: 24upx;
		padding: 10upx 0 10upx 0;
		margin-top: 10upx;
	}
	.po{
		flex: 1;
	}
	.pox{
/* 		text-overflow: ellipsis; */
		overflow: hidden; 
		white-space: nowrap; 
		flex: 1;
		line-height: 100upx;
	}
	.txt{
		padding-top: 20upx;
		flex: 1;
	}
</style>
